@model BTCPayServer.Models.ServerViewModels.LogsViewModel
@{
    ViewData.SetLayoutModel(new LayoutModel(nameof(ServerNavPages.Logs), StringLocalizer["Logs"])
        .SetCategory(WellKnownCategories.Server));
}

<div class="sticky-header">
	<h2 class="my-1">@ViewData["Title"]</h2>
</div>
<partial name="_StatusMessage" />

<ul class="list-unstyled">
    @foreach (var file in Model.LogFiles)
    {
        <li>
            <a asp-action="LogsView" asp-route-file="@file.Name" asp-route-offset="@Model.LogFileOffset">@file.Name</a>
            <a asp-action="LogsView" asp-route-file="@file.Name" asp-route-offset="@Model.LogFileOffset" asp-route-download="true" class="mx-2">
                <vc:icon symbol="actions-download" />
            </a>
        </li>
    }
</ul>

<nav aria-label="..." class="w-100">
    <ul class="pagination float-start">
        <li class="page-item @(Model.LogFileOffset == 0 ? "disabled" : null)">
            <a class="page-link" asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)">&laquo;</a>
        </li>
        <li class="page-item disabled">
            <span class="page-link">@StringLocalizer["Showing {0} of {1}", Model.LogFileOffset - (Model.LogFileOffset + Model.LogFiles.Count), Model.LogFileCount]</span>
        </li>
        <li class="page-item @(Model.LogFileOffset + Model.LogFiles.Count < Model.LogFileCount ? null : "disabled")">
            <a class="page-link" asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">&raquo;</a>
        </li>
    </ul>
</nav>

@if (!string.IsNullOrEmpty(Model.Log))
{
<br>
<br>
<br>

<pre>
@Model.Log
</pre>
}


@section PageFootContent {
    <partial name="_ValidationScriptsPartial" />
}
